package com.crt.nexus.user.controller;

import com.crt.nexus.core.response.R;
import com.crt.nexus.domain.dtos.UserDto;
import com.crt.nexus.security.annotation.Inner;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@Inner
@Slf4j
@RefreshScope
@RestController
@RequiredArgsConstructor
@RequestMapping("/feign/users")
public class UserFeignController {

    @GetMapping("/{username}")
    public R<UserDto> detail(@PathVariable String username) {
        log.debug("username: {}", username);
        UserDto dto = new UserDto();
        dto.setUsername("Jalen");
        dto.setTruename("Yangwei");
        dto.setState("closed");
        dto.setBalance(BigDecimal.valueOf(19999));
        dto.setEnable(false);
        return R.ok(dto);
    }

}
